fn is_prime(n: u64) -> bool {
    if n <= 1 {
        return false;
    }
    if n <= 3 {
        return true;
    }
    if n % 2 == 0 || n % 3 == 0 {
        return false;
    }
    let mut i = 5;
    while i * i <= n {
        if n % i == 0 || n % (i + 2) == 0 {
            return false;
        }
        i += 6;
    }
    true
}

fn can_be_expressed(n: u64) -> bool {
    let limit = ((n / 2) as f64).sqrt() as u64;
    for i in 1..=limit {
        let prime_candidate = n - 2 * i * i;
        if prime_candidate > 0 && is_prime(prime_candidate) {
            return true;
        }
    }
    false
}


pub fn goldbach_conjecture() -> u64 {
    let mut count = 0;
    let mut sum = 0;
    let mut number = 9; // 第一个奇合数是9

    while count < 2 {
        if !is_prime(number) && !can_be_expressed(number) {
            sum += number;
            count += 1;
        }
        number += 2; // 只考虑奇数
    }
    sum
}
